home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / Projects / Questions & Answers / Q&A Programming Music / Programming groove generator < prev    next >
Lisp/Scheme  |  1998-10-26  |  4KB  |  157 lines

  1. HOW TO PROGRAM A GROOVE GENERATOR
  2.  
  3. Before making a robot that creates 100 new pieces in an hour you
  4. need to understand the basics. Here is a simple groove box. Run the 
  5. score and keep changing the init-rnd seed. Each time you 
  6. get a new combination based on element definitions.
  7.  
  8. With current symbols snare perc and hihat might not be in your setup
  9. what the names say. define drummap or use def-drumset.
  10.  
  11. What you put in that will come out.
  12.  
  13. Change element definitions. Replace them with generators.
  14. What does the timesheet do? Double-click def-section-timesheet. 
  15. When you understand how this score is put together you can add as much
  16. instruments as you want. Extend the timesheet.
  17.  
  18. Try randomizing the timesheet and rhythms with pulse-string. See
  19. the docs and you'll immediately see the possibilities. Use mix-strings
  20. to combine multiple pulse-string outputs.
  21.  
  22. Bass is fixed. Try changing it.
  23.  
  24. If you work on dancable styles keep patterns 1, 2 and max 4 patterns.
  25. Implement intelligent variation mechanisms. Use analog sounds.
  26. You'll find it fun to add fractal patterns on top of grooves.
  27.  
  28. If you are working on zones you are already on the level that you 
  29. can handle randomization on your own based on this example.
  30.  
  31. If you make enhancements to this example it is appreciated that
  32. you post it back to the list.
  33.  
  34. (init-rnd 0.11253334)
  35.  
  36. (def-orchestra 'orchestra
  37.    all-instruments (drums instruments)
  38.    instruments (bass sequence)
  39.    drums (kick snare hihat perc)
  40. )
  41.  
  42. ; element definitions
  43.  
  44. (setq kicks '(
  45. ;    1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
  46.     "-   -   -   -   -   -   -   -   "
  47.     "-   -   -   - - -   -   -   -   "
  48.     "-   -   -   -   -   -   -   -   -   -   -   -   -   -   -   - - "
  49.     "-   -   -   -   -   -   -    ---"
  50. ))
  51.  
  52. (setq snares '(
  53. ;    1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
  54.     "    -       -       -       -       -       -       -       -   "
  55.     "  -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   - "
  56.     "    -       -       -       -       -       -       -      --   "
  57.     "          -               -               -               -     "
  58. ))
  59.  
  60. (setq hihats '(
  61. ;   1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
  62.    "------- - -- ------------ -- ---"
  63.    "---- ------- ------- -------- - "
  64.    "  -    -  -   -   -   -   -   - "
  65.    " - - - - - - - - - - - - - - -  "
  66.    "----------------"
  67. ))
  68.  
  69. (setq velocities '(
  70.    (90 100 110 120)
  71.    (120 100 110 100)
  72.    (100 120 80 110)
  73.    (127 90)
  74.    (120 100 80)
  75. ))
  76.  
  77. (setq symbols '(
  78.    (a b a c)
  79.    (a b c -b)
  80.    (a d c b)
  81.    (a a -b a)
  82.    (a b -b a)
  83. ))
  84.  
  85. (setq rhythms '(
  86. ;   1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
  87.    "- - --- -       "
  88.    "  --  -   -   - "
  89.    "  -  -  -  -----"
  90.    "  -- --         "
  91. ))
  92.  
  93. (def-section-timesheet sect-a
  94.    ;
  95.    ; timesheet = bars that the instruments play
  96.    ;
  97.    with 1/1
  98.    tonality drums
  99.    ;           1       9       17      etc bars
  100.    ;           !---!---!---!---!---!---!---!---!
  101.    kick       "--------------- ------- --  "
  102.    hihat      "  --------------------- --  "
  103.    perc       "    ----------------------  "
  104.    snare      "      ----------------- --  "
  105.    ;
  106.    ; instruments
  107.    ;
  108.    tonality (activate-tonality (hirajoshi c 3))
  109.    ;           1       9       17      etc bars
  110.    ;           !---!---!---!---!---!---!---!---!
  111.    bass       "        ------------        "
  112.    sequence   "            ----------------"
  113.    ;
  114.    ; drums
  115.    ;
  116.    beat 1/16 ; !---!---!---!---!
  117.    kick       (pick-random kicks) '(b) with '(127)
  118.    snare      (pick-random snares) 
  119.                 (list (pick-random '(c d e f))) 
  120.                    with (pick-random velocities)
  121.    perc       (pick-random hihats) 
  122.                 (list (pick-random '(p q r s t))) 
  123.                    with (pick-random velocities)
  124.    hihat      (pick-random hihats) 
  125.                 (list (pick-random '(j k l m n))) 
  126.                    with (pick-random velocities)
  127.    ;
  128.    ; instruments
  129.    ;
  130.    beat 1/16 ; !---!---!---!---!
  131.    legato (fix 1/32)
  132.    sequence    (pick-random rhythms) 
  133.                  (pick-random symbols) 
  134.                     with (pick-random velocities)
  135. )
  136.  
  137. (def-section sect-a
  138.    drums
  139.       channel 10
  140.    bass
  141.       channel 2
  142.       symbol '(a)
  143.       length '(-1/8 1/8)
  144.       velocity '(127)
  145.    sequence
  146.       channel 1
  147. )
  148.  
  149. (midiport :printer)
  150.  
  151. (def-tempo 140)
  152.  
  153. (play-file-p "boom-says-the-bass"
  154.    all-instruments '(sect-a)
  155. )
  156.  
  157.